package com.oocl.ajax.factory;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.oocl.ajax.util.DBUtil;

/**
 * @description: 
 * @author  XIEMI2
 * @date Aug 1, 2017 9:13:25 PM
 * @version 1.0
 */
public class DBFactory {
	private static Connection con;

	public static Connection getCon() {
		con = DBUtil.createConnectionWithDataSource();
		return con;
	}
	
	/**
	 * 
	 * @param con
	 * @param pst
	 * @param rs
	 */
	public static void close(Connection con, PreparedStatement pst, ResultSet rs){
		try {
			if(rs!=null)
				rs.close();
			if(pst!=null)
				pst.close();
			if(con!=null)
				con.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
	
}


